﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="order_list.aspx.cs" Inherits="Com.CMS263.Web.manage.OrderManage.order_list" %>

<%@ Import Namespace="Com.CMS263.PO" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>后台-产品管理</title>
    <link href="/manage/css/common.css" rel="stylesheet" type="text/css" />
    <link href="/manage/css/main.css" rel="stylesheet" type="text/css" />
    <link href="/manage/css/box.css" rel="stylesheet" type="text/css" />

    <script language="javascript" type="text/javascript" src="/manage/js/common.js"></script>

    <script language="javascript" type="text/javascript" src="/manage/js/pager.js"></script>

    <script language="javascript" type="text/javascript" src="/manage/js/kun.js"></script>

    <script language="javascript" type="text/javascript" src="/manage/js/jquery-1.4.2.min.js"></script>

    <script type="text/javascript" language="javascript">
        function Del(id, obj) {
            $.post("product_action.aspx?op=del", { id: id }, function(data) {
                if (data == '1') {
                    alert("删除成功");
                    $(obj).parent().parent().remove();
                }
                else {
                    alert("删除失败");
                }
            })

        }
        function updateItem(id, obj) {
            $.post("product_action.aspx?op=updateItem", { id: id }, function(data) {
                if (data == '1') {
                    $(obj).html("正常");
                }
                else if (data == '0') {
                    $(obj).html("<span style='color:red'>已下架</span>");
                }
                else {
                    alert("修改失败");
                }
            })
        }
        $(function() {
            $("#txtSearchStyle").val("<%=styleid %>");
            $("#txtSearchState").val("<%=state %>");
        })
        function chkAll(obj) {
            //alert($("#tab1 input[name='chk']").length);
            $("#tab1 input[name='chk']").attr("checked", $(obj).attr("checked"));
        }
        function batch() {
            var ids = $("#tab1 input[name='chk']:checked");
            var idval = "";
            $.each(ids, function() {
                idval = idval + $(this).val() + ",";
            })

            return realBatch("确认进行批量操作吗", idval);
        }
    </script>

    <script type="text/javascript" language="javascript" src="/manage/js/ui.core.js"></script>

    <link href="/manage/js/themes/base/ui.all.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" language="javascript" src="/manage/js/ui.datepicker.js"></script>

    <script type="text/javascript" language="javascript">
        $(function() {
            $("#txtSearchKey").datepicker({
                closeText: '关闭',
                prevText: '&#x3c;上月',
                nextText: '下月&#x3e;',
                currentText: '今天',
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
		'七月', '八月', '九月', '十月', '十一月', '十二月'],
                monthNamesShort: ['一', '二', '三', '四', '五', '六',
		'七', '八', '九', '十', '十一', '十二'],
                dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
                dayNamesShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
                dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'],
                dateFormat: 'yy-mm-dd', firstDay: 1,
                isRTL: false
            });
        })
    </script>

    <script type="text/javascript" language="javascript">
        function changeProvince() {
            var id = $("#txtProvince").val();
            $.post("/area_action.aspx?op=province", { id: id }, function(data) {
            $("#txtCity").html("<option value='0'>全部</option>");
                var province = data.split(';');

                $.each(province, function() {
                    if (this != "" && this.length > 0) {
                        var co = this.split(',');
                        $("#txtCity").append("<option value='" + co[0] + "'>" + co[1] + "</option>");
                    }
                })
                
            })
        }
        $(function() {
            var id = $("#txtProvince").val();
            $.post("/area_action.aspx?op=province", { id: id }, function(data) {
                $("#txtCity").html("<option value='0'>全部</option>");

                var province = data.split(';');
                $.each(province, function() {
                    if (this != "" && this.length > 0) {
                        var co = this.split(',');
                        $("#txtCity").append("<option value='" + co[0] + "'>" + co[1] + "</option>");
                    }
                })
            })
        })
        function changeCity() {
            var id = $("#txtCity").val();
            $.post("/area_action.aspx?op=city", { id: id }, function(data) {
                $("#txtArea").html("");
                var city = data.split(';');

                $.each(city, function() {
                    if (this != "" && this.length > 0) {
                        var co = this.split(',');
                        $("#txtArea").append("<option value='" + co[0] + "'>" + co[1] + "</option>");
                    }
                })

            })
        }
       
    </script>

</head>
<body>
    <form id="form1" name="form1" runat="server" action="order_list.aspx" method="post"
    enctype="multipart/form-data">
    <div class="main">
        <div class="mainMenu">
            <div class="mainMenuList">
                <ul>
                    <li class="s"><a href="order_list.aspx"><b>订单列表</b><span></span></a></li>
                </ul>
            </div>
        </div>
        <div class="mainContent">
            <div class="productSearch">
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table1">
                    <tr>
                        <td width="80" class="c">
                            所属规模
                        </td>
                        <td width="60" class="c">
                            <select name="txtSearchStyle" id="txtSearchStyle" class="input1" style="width: 60px">
                                <option value="0">全部</option>
                                <option value="100">100</option>
                                <option value="150">150</option>
                                <option value="200">200</option>
                            </select>
                        </td>
                        <td width="80" class="c">
                            订单状态
                        </td>
                        <td width="100" class="c">
                            <select name="txtSearchState" id="txtSearchState" class="input1" style="width: 100px">
                                <option value="0">全部</option>
                                <option value="2">等待审核</option>
                                <option value="3">待支付定金</option>
                                <option value="4">待支付尾款</option>
                                <option value="1">成功订单</option>
                            </select>
                        </td>
                        <td width="60" class="c">
                            吉日
                        </td>
                        <td width="50" class="c">
                            <input type="text" value="" id="txtSearchKey" name="txtSearchKey" style="width: 80px" />
                        </td>
                        <td width="500" class="c">
                        </td>
                    </tr>
                    <tr>
                        <td width="80" class="c">
                            婚典地区(省)
                        </td>
                        <td width="100" class="c">
                            <select class="input1" id="txtProvince" name="txtProvince" onchange="changeProvince()">
                                <option value="0">全部</option>
                                <% foreach (Province prov in provlist)
                                   {%>
                                <option value="<%=prov.Code %>">
                                    <%=prov.Name %></option>
                                <%} %>
                            </select>
                        </td>
                        <td width="80" class="c">
                            婚典地区(市)
                        </td>
                        <td width="100" class="c">
                            <select class="input1" id="txtCity" name="txtCity" >
                                <option value="0">全部</option>
                            </select>
                        </td>
                        <td class="c" colspan="3">
                            <asp:Button ID="btnSearch" runat="server" Text="搜索" OnClick="btnSearch_Click" />
                        </td>
                    </tr>
                </table>
            </div>
            <div class="productList">
                <table width="100%" id="tab1" border="0" cellspacing="0" cellpadding="0" class="table2">
                    <tr>
                        <th width="40" class="c">
                            <input type="checkbox" onclick="chkAll(this)" />全选
                        </th>
                        <th width="40" class="c">
                            订单号
                        </th>
                        <th width="100" class="c">
                            订单时间
                        </th>
                        <th width="60" class="c">
                            价格
                        </th>
                        <th width="40" class="c">
                            规模
                        </th>
                        <th class="c" width="100">
                            吉日
                        </th>
                        <th class="c" width="100">
                            状态
                        </th>
                        <th width="80" class="c">
                            联系人
                        </th>
                        <th width="80" class="c">
                            手机
                        </th>
                        <th width="40" class="c">
                            操作
                        </th>
                    </tr>
                    <% foreach (UserOrder prod in prodlist)
                       {%>
                    <tr>
                        <td width="40" class="c">
                            <input type="checkbox" name="chk" value="<%=prod.Id %>" />
                        </td>
                        <td class="c">
                            <font class="f11">
                                <%=string.Format("{0:D7}", prod.OrderNum)%></font>
                        </td>
                        <td>
                            <%=prod.AddDate.ToString("yyyy-MM-dd HH:mm:ss") %>
                        </td>
                        <td>
                            ￥<%=prod.OrderPrice%>
                        </td>
                        <td class="c">
                            <%=prod.MystyleId %>
                        </td>
                        <td class="c">
                            <%=prod.MarryDate.ToString("yyyy-MM-dd") %>
                        </td>
                        <td class="c">
                            <% if (prod.State == 1)
                               { %>成功订单<%}
                               else if (prod.State == 2)
                               { %>等待审核<%}
                               else if (prod.State == 3)
                               {%>待支付定金
                            <%}
                               else if (prod.State == 4)
                               {%>待支付尾款<%} %>
                        </td>
                        <td class="c">
                            <%CustomerList cucu = (CustomerList)custbll.FindModelById("CustomerList", prod.UserId);%>
                            <%=cucu.UserName %>
                        </td>
                        <td class="c">
                            <%=cucu.Mobile %>
                        </td>
                        <td class="c">
                            <a href="order_show.aspx?id=<%=prod.Id %>" class="c369">查看</a>
                        </td>
                    </tr>
                    <%} %>
                    <tr>
                        <td colspan="3">
                            <select name="txtBatch" id="txtBatch" class="input1" style="width: 155px">
                                <option value="2">不通过审核</option>
                                <option value="3">通过审核</option>
                                <option value="4">定金支付成功</option>
                                <option value="1">成功订单</option>
                            </select><asp:Button ID="btnBatch" runat="server" OnClientClick="return batch()"
                                Text="批量操作" OnClick="btnBatch_Click" />
                        </td>
                        <td colspan="7">
                            <div style="float: right; margin-right: 100px">
                                <%=GetPager()%></div>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    </form>
</body>
</html>
